<div class="tab_item" style="display: block">
    <div class="toolbar clearfix">
        <div class="float_right">
            <button class="btn btn_green" onclick="batch_pay_${pid}()">批量付款</button>
        </div>
        <h3>待付寄件</h3>
    </div>
    <div class="grid" style="height:345px;">
        <table id="page_table_box_${pid}"></table>
    </div>
</div>


<script>

    (function () {
        $('#page_table_box_${pid}').datagrid({
            fit: true,
            width: '100%',
            height: '100%',
            striped: true,
            url: "${contextPath}/security/ykdg/send_order/customer_wait_pay.htm?customerId=${customerId}",
            fitColumns: true,
            idField: 'id',
            singleSelect: true,
            selectOnCheck: false,
            checkOnSelect: false,
            autoRowHeight: false,
            rowStyler: gridRowStyler,
            columns: [
                [
                    { field: 'checkbox', checkbox: true },
                    {
                        title: '金额',
                        align: 'center',
                        field: 'charge',
                        width: 15,
                        formatter:function(val, row) {
                            if(val > 0) {
                                return val / 100;
                            }
                        }
                    },
                    {
                        title: '类型',
                        align: 'center',
                        field: 'boxType',
                        width: 10,
                        formatter: function(val, row) {
                            if(val == 1) return '小';
                            if(val == 2) return '中';
                            if(val == 3) return '大';
                        }
                    },
                    {
                        title: '状态',
                        align: 'center',
                        field: 'orderStatusName',
                        width: 10
                    },
                    {
                        title: '入箱时间',
                        align: 'center',
                        field: 'putTime',
                        width: 30
                    }
                ]
            ]
        });
    })();

    function batch_pay_${pid}() {
        var checked = $('#page_table_box_${pid}').datagrid('getChecked');
        if(checked.length == 0) {
            $.messager.alert('提示信息', '请选择记录', 'info');
            return;
        }

        var list = [];
        for(var i = 0; i < checked.length; i++) {
            list.push(checked[i].id);
        }

        $.post('${contextPath}/security/ykdg/send_order/customer_pay.htm', {
            id: list
        }, function(json) {
            if (json.success) {
                $.messager.alert('提示消息', json.message, 'info');
                $('#page_table_box_${pid}').datagrid('reload');
            } else {
                $.messager.alert('提示消息', json.message, 'info');
            }
        }, 'json');
    }
</script>